package cn.wolfcode.service;

import cn.wolfcode.domain.OperateIntergralVo;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

/**
 * Created by lanxw
 */
@LocalTCC
public interface IUsableIntegralService {
    /**
     * 积分支付，给对应的积分账户减积分
     * @param vo
     */
    void decrIntergral(OperateIntergralVo vo);

    /**
     * 积分退款，给积分用户加积分
     * @param vo
     */
    void incrIntergral(OperateIntergralVo vo);
    /**
     * 增加积分
     */
    @TwoPhaseBusinessAction(name = "incrIntergralTry", commitMethod = "incrIntergralConfirm", rollbackMethod = "incrIntergralCancel")
    void incrIntergralTry(@BusinessActionContextParameter(paramName = "operateIntergralVo") OperateIntergralVo operateIntergralVo, BusinessActionContext context);
    void incrIntergralConfirm(BusinessActionContext context);
    void incrIntergralCancel(BusinessActionContext context);
}
